<?php
/* $Id$ */


class File {

	function File() {

	}


	function create() {

	}

	function removeDirectoryRecursive( $path ) {

		//echo "<p>Pfad ".$path."</p>";

		if ( is_dir ($path) ) {
			$dir_d = opendir( $path );
			if ($dir_d === false) return false;
			
			while( ($filename = readdir($dir_d)) !== false ) {

				if ( strlen($filename) > 1 ) {
 
					//echo "<p>filename ".$filename." filetype: ".@filetype($filename);

					if ( (@filetype($filename) == "dir") ) {

						if  ( ($filename != "..") && ($filename != ".") ) {
							//echo "gehe zu pfad ".$filename;
							//File::removeDirectoryRecursive( $path.$filename );
						}
					} else {
						/* Einfache Datei loeschen */

						if ( ($filename != "..") && ($filename != ".") ) {
							//echo "<p>Loesche ".$path.$filename."</p>";
							unlink ( $path.$filename );
						}
					}
				} 
			}
			
			rmdir ( $path );

		}
	}


	function regenerateDirectory( $path ) {
		File::removeDirectoryRecursive( $path );
		mkdir ( $path );
	}

}



?>